package de.l3s.forgetit.services.schema;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;

@XmlType
public class PIMOAction implements Action {

	private String uri;
	private String label;
	private String timestamp;
	private String userUri;
	private String application;
	private String type;
	private PIMOResource resource;
	private MetaData extra;
	
	public PIMOAction() {
		extra = new MetaData();
	}
	
	@XmlAttribute(name = "uri")
	@XmlSchemaType(name = "string")
	public String getUri() {
		return uri;
	}
	
	@XmlAttribute(name = "label")
	@XmlSchemaType(name = "string")
	public String getLabel() {
		return label;
	}
	
	@XmlAttribute(name = "timestamp")
	@XmlSchemaType(name = "string")
	public String getTimestamp() {
		return timestamp;
	}
	
	@XmlAttribute(name = "userUri")
	@XmlSchemaType(name = "string")
	public String getUserUri() {
		return userUri;
	}
	
	@XmlAttribute(name = "application")
	@XmlSchemaType(name = "string")
	public String getApplication() {
		return application;
	}

	@XmlAttribute(name = "type", required = true)
	@XmlSchemaType(name = "string")
	public String getType() {
		return type;
	}

	@XmlElement(name = "resource", type = PIMOResource.class)
	public PIMOResource getResource() {
		return resource;
	}

	@XmlElement(name = "extra", type = MetaData.class)
	public MetaData getMetaData() {
		return extra;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setTimestamp(String ts) {
		this.timestamp = ts;
	}
	
	public void setUserUri(String u) {
		this.userUri = u;
	}
	
	public void setUri(String u) {
		this.uri = u;
	}
	
	public void setApplication(String app) {
		this.application = app;
	}
	
	public void setResource(PIMOResource resource) {
		this.resource = resource;
	}
	
	public void setResource(String type, String label, String uri) {
		PIMOResource res = new PIMOResource(type, label, uri);
		this.resource = res;
	}

	public void setExtra(MetaData extra) {
		this.extra = extra;
	}
}
